#!/sbin/openrc-run

name="ssh-honeypot daemon"
description="Fake sshd that logs ip addresses, usernames, and passwords."
command=/usr/bin/ssh-honeypot
command_args="${SSHHONEYPOT_ARGS}"
prog_name="ssh-honeypot"
key_path="/usr/share/${prog_name}/honeypot.rsa"
pid_file="/var/run/${prog_name}.pid"
start_stop_daemon_args="-b -m --pidfile ${pidfile} -- "

depend() {
  need net
}

start_pre() {
  if ! checkpath -f "${key_path}"; then
    ebegin "Generating key"
      /usr/bin/ssh-keygen -t rsa -f ${key_path} -q -N ""
    eend $?
  fi
}

